<template>
  <div class="taks">
    <div class="content">
      <!-- 搜索栏 -->
      <div class="top">
        <el-form
          :model="ListForm"
          ref="ListForm"
          label-width="100px"
          class="demo-ListForm"
          style="display: flex; flex-wrap: wrap"
        >
          <!-- 输入框 -->
          <el-form-item label="单据编号" prop="billNo">
            <el-input
              v-model="ListForm.billNo"
              placeholder="请输入单据编号"
              clearable
              @clear="findList()"
            ></el-input>
          </el-form-item>
          <!-- 时间选择器 -->
          <el-form-item label="单据日期" prop="billDate_begin">
            <el-date-picker
              v-model="ListForm.billDate_begin"
              type="date"
              value-format="yyyy-MM-dd"
              placeholder="选择开始日期"
            >
            </el-date-picker>
            ~
            <el-date-picker
              v-model="ListForm.billDate_end"
              type="date"
              value-format="yyyy-MM-dd"
              placeholder="选择结束日期"
            >
            </el-date-picker>
          </el-form-item>
          <!-- 选择器 -->
          <el-form-item label="客户" prop="customerId">
            <el-select v-model="ListForm.customerId" placeholder="请选择客户">
              <el-option label="请选择客户" value=""></el-option>
              <el-option
                v-for="(item, index) in CustomerInformation"
                :key="index"
                :label="item.text"
                :value="item.value"
              ></el-option>
            </el-select>
          </el-form-item>
          <!-- 是否展开隐藏 -->
          <template v-if="arrow_down_up == true">
            <!-- 选择器 -->
            <el-form-item label="处理状态" prop="billProcStatus">
              <el-select
                v-model="ListForm.billProcStatus"
                placeholder="请选择处理状态"
              >
                <el-option label="请选择处理状态" value=""></el-option>
                <el-option label="编制" value="1"></el-option>
                <el-option label="编制" value="12"></el-option>
                <el-option label="编制完成" value="13"></el-option>
                <el-option label="审核" value="2"></el-option>
                <el-option label="审核开始" value="21"></el-option>
                <el-option label="审核中" value="22"></el-option>
                <el-option label="审核完成" value="23"></el-option>
                <el-option label="执行" value="3"></el-option>
                <el-option label="执行中" value="32"></el-option>
                <el-option label="执行完成" value="33"></el-option>
              </el-select>
            </el-form-item>
            <!-- 选择器 -->
            <el-form-item label="是否关闭" prop="isClosed">
              <el-select
                v-model="ListForm.isClosed"
                placeholder="请选择是否关闭"
              >
                <el-option label="请选择是否关闭" value=""></el-option>
                <el-option
                  v-for="(item, index) in YesOrNo"
                  :key="index"
                  :label="item.text"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
            <!-- 选择器 -->
            <el-form-item label="是否作废" prop="isVoided">
              <el-select
                v-model="ListForm.isVoided"
                placeholder="请选择是否作废"
              >
                <el-option label="请选择是否作废" value=""></el-option>
                <el-option
                  v-for="(item, index) in YesOrNo"
                  :key="index"
                  :label="item.text"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </template>
          <div style="margin-left: 10px">
            <el-button icon="el-icon-search" type="primary" @click="findList()"
              >查询</el-button
            >
            <el-button icon="el-icon-refresh" @click="reset()">重置</el-button>
            <el-button
              type="text"
              v-if="arrow_down_up == false"
              @click="arrow_down_up = true"
              >展开 <i class="el-icon-arrow-down"></i>
            </el-button>
            <el-button
              type="text"
              v-if="arrow_down_up == true"
              @click="arrow_down_up = false"
              >收起 <i class="el-icon-arrow-up"></i>
            </el-button>
          </div>
        </el-form>
      </div>
      <!-- 操作栏 -->
      <div style="display: flex; justify-content: space-between">
        <div class="leftButton">
          <el-button
            icon="el-icon-plus"
            type="text"
            @click="addButton('应收核销 - 新增')"
          >
            新增
          </el-button>
          <el-button icon="el-icon-download" type="text">导入</el-button>
          <el-button icon="el-icon-top" type="text">导出</el-button>
          <el-dropdown v-if="moredelete == true">
            <el-button>
              批量操作<i class="el-icon-arrow-down el-icon--right"></i>
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item icon="el-icon-delete">
                <el-button type="text" @click="MoreDelete()">删除</el-button>
              </el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
          <el-button readonly type="text">
            已选择{{ multipleSelection.length }}项
          </el-button>
          <el-button type="text" @click="qingkong()">清空</el-button>
        </div>
        <div class="leftButton">
          <el-button icon="el-icon-setting" type="text">自定义列</el-button>
        </div>
      </div>
      <!-- 表单 -->
      <div class="table">
        <el-table
          ref="multipleTable"
          :data="ListData"
          tooltip-effect="dark"
          style="width: 100%"
          border
          @selection-change="handleSelectionChange"
        >
          <el-table-column fixed type="selection" width="55"></el-table-column>
          <el-table-column
            fixed
            label="#"
            type="index"
            width="50"
          ></el-table-column>
          <el-table-column fixed label="单据编号" width="170">
            <template slot-scope="scope">{{ scope.row.billNo }}</template>
          </el-table-column>
          <el-table-column label="单据日期" width="120">
            <template slot-scope="scope">{{ scope.row.billDate }}</template>
          </el-table-column>
          <el-table-column label="客户" width="120">
            <template slot-scope="scope">{{
              scope.row.customerId_dictText
            }}</template>
          </el-table-column>

          <el-table-column label="处理状态" width="80">
            <template slot-scope="scope">{{
              scope.row.billProcStatus_dictText
            }}</template>
          </el-table-column>
          <el-table-column label="是否通过" width="80">
            <template slot-scope="scope">{{
              scope.row.isApproved_dictText
            }}</template>
          </el-table-column>
          <el-table-column label="是否关闭" width="80">
            <template slot-scope="scope">{{
              scope.row.isClosed_dictText
            }}</template>
          </el-table-column>
          <el-table-column label="是否作废" width="80">
            <template slot-scope="scope">{{
              scope.row.isVoided_dictText
            }}</template>
          </el-table-column>
          <el-table-column label="备注" width="160">
            <template slot-scope="scope">{{ scope.row.remark }}</template>
          </el-table-column>
          <el-table-column label="生效时间" width="120">
            <template slot-scope="scope">{{
              scope.row.effectiveTime
            }}</template>
          </el-table-column>
          <el-table-column label="审核人" width="80">
            <template slot-scope="scope">{{
              scope.row.approverId_dictText
            }}</template>
          </el-table-column>
          <el-table-column label="流程" width="160">
            <template slot-scope="scope">{{ scope.row.flowId }}</template>
          </el-table-column>
          <el-table-column label="创建时间" width="160">
            <template slot-scope="scope">{{ scope.row.billDate }}</template>
          </el-table-column>
          <el-table-column label="创建人" width="80">
            <template slot-scope="scope">{{
              scope.row.createBy_dictText
            }}</template>
          </el-table-column>
          <el-table-column label="创建部门" width="120">
            <template slot-scope="scope">{{ scope.row.attachment }}</template>
          </el-table-column>
          <el-table-column label="修改时间" width="160">
            <template slot-scope="scope">{{ scope.row.updateTime }}</template>
          </el-table-column>
          <el-table-column label="修改人" width="80">
            <template slot-scope="scope">{{
              scope.row.updateBy_dictText
            }}</template>
          </el-table-column>

          <el-table-column fixed="right" label="操作" width="120">
            <template slot-scope="scope">
              <el-button @click="handleClick(scope.row)" type="text">
                编辑
              </el-button>
              |
              <el-dropdown>
                <span class="el-dropdown-link">
                  更多<i class="el-icon-arrow-down el-icon--right"></i>
                </span>
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item>
                    <el-popconfirm title="这是一段内容确定删除吗？">
                      <el-button
                        type="text"
                        @click="deleteList(scope.row)"
                        slot="reference"
                        >删除</el-button
                      >
                    </el-popconfirm>
                  </el-dropdown-item>
                  <el-dropdown-item>
                    <el-button type="text" disabled>审核</el-button>
                  </el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!-- 模态框 -->
      <div class="dialog">
        <el-dialog :title="title" :visible.sync="dialogFormVisible" width="70%">
          <el-form
            :model="addForm"
            ref="addForm"
            label-width="100px"
            class="demo-addForm"
            :rules="rules"
          >
            <div style="display: flex; align-items: flex-start">
              <el-form-item label="处理状态" prop="billProcStatus">
                <el-select disabled v-model="addForm.billProcStatus">
                  <el-option label="请选择处理状态" value=""></el-option>
                  <el-option label="编制" value="1"></el-option>
                  <el-option label="编制" value="12"></el-option>
                  <el-option label="编制完成" value="13"></el-option>
                  <el-option label="审核" value="2"></el-option>
                  <el-option label="审核开始" value="21"></el-option>
                  <el-option label="审核中" value="22"></el-option>
                  <el-option label="审核完成" value="23"></el-option>
                  <el-option label="执行" value="3"></el-option>
                  <el-option label="执行中" value="32"></el-option>
                  <el-option label="执行完成" value="33"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                style="width: 220px"
                label="是否通过"
                prop="isApproved"
              >
                <el-select disabled v-model="addForm.isApproved">
                  <el-option
                    v-for="(item, index) in CustomerInformation"
                    :key="index"
                    :label="item.text"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                style="width: 220px"
                label="是否关闭"
                prop="isClosed"
              >
                <el-select disabled v-model="addForm.isClosed">
                  <el-option
                    v-for="(item, index) in CustomerInformation"
                    :key="index"
                    :label="item.text"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                style="width: 220px"
                label="是否作废"
                prop="isVoided"
              >
                <el-select disabled v-model="addForm.isVoided">
                  <el-option
                    v-for="(item, index) in CustomerInformation"
                    :key="index"
                    :label="item.text"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
              <!-- 展开收起 -->
              <el-button
                style="padding-left: 40px"
                type="text"
                v-if="arrow_down_up2 == false"
                @click="arrow_down_up2 = true"
                >展开 <i class="el-icon-arrow-down"></i>
              </el-button>
              <el-button
                style="padding-left: 40px"
                type="text"
                v-if="arrow_down_up2 == true"
                @click="arrow_down_up2 = false"
                >收起 <i class="el-icon-arrow-up"></i>
              </el-button>
            </div>
            <template v-if="arrow_down_up2 == true">
              <div style="display: flex">
                <el-form-item label="创建时间" prop="createTime">
                  <el-date-picker
                    disabled
                    v-model="addForm.createTime"
                    type="date"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="创建人" prop="createBy_dictText">
                  <el-select
                    disabled
                    v-model="addForm.createBy_dictText"
                    placeholder=""
                  >
                    <el-option label="编制中" value="0"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="创建部门" prop="sysOrgCode_dictText">
                  <el-select disabled v-model="addForm.sysOrgCode_dictText">
                    <el-option
                      label="北京国炬公司"
                      :value="addForm.sysOrgCode_dictText"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </div>
              <div style="display: flex">
                <el-form-item label="生效时间" prop="effectiveTime">
                  <el-date-picker
                    disabled
                    v-model="addForm.effectiveTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择结束日期"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="审核人" prop="approverId_dictText">
                  <el-select disabled v-model="addForm.approverId">
                    <el-option label="编制中" value="0"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="流程" prop="flowId">
                  <el-input v-model="addForm.flowId" readonly></el-input>
                </el-form-item>
              </div>
              <div style="display: flex">
                <el-form-item label="修改时间" prop="updateTime">
                  <el-date-picker
                    disabled
                    v-model="addForm.updateTime"
                    type="date"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="修改人" prop="updateBy">
                  <el-select disabled v-model="addForm.updateBy">
                    <el-option label="编制中" value="0"></el-option>
                  </el-select>
                </el-form-item>
                <div></div>
              </div>
            </template>
            <div style="display: flex">
              <el-form-item label="单据编号" prop="billNo">
                <el-input v-model="addForm.billNo" readonly></el-input>
              </el-form-item>
              <el-form-item label="单据日期" prop="billDate">
                <el-date-picker
                  v-model="addForm.billDate"
                  type="date"
                  value-format="yyyy-MM-dd"
                  placeholder="选择开始日期"
                >
                </el-date-picker>
              </el-form-item>
              <el-form-item label="制单人" prop="createBy">
                <el-select disabled v-model="addForm.createBy">
                  <el-option
                    :label="addForm.createBy_dictText"
                    :value="addForm.createBy"
                  ></el-option>
                </el-select>
              </el-form-item>
            </div>
            <div style="display: flex">
              <el-form-item style="flex: 1" label="客户" prop="customerId">
                <el-select v-model="addForm.customerId">
                  <el-option label="请选择客户" value=""></el-option>
                  <el-option
                    v-for="(item, index) in CustomerInformation"
                    :key="index"
                    :label="item.text"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item style="flex: 2" label="备注" prop="remark">
                <el-input
                  type="textarea"
                  v-model="addForm.remark"
                  placeholder="备注"
                ></el-input>
              </el-form-item>
            </div>
            <!-- 四个模态框 -->
            <div style="display: flex">
              <!-- 应收单模块 -->
              <div style="width: 48%">
                <div style="height: 200px">
                  <div>应收单</div>
                  <el-table
                    ref="multipleTable"
                    :data="yingshoutableData"
                    tooltip-effect="dark"
                    style="width: 100%"
                  >
                    <el-table-column type="selection" width="55">
                    </el-table-column>
                    <el-table-column label="单据号" width="170">
                      <template slot-scope="scope">{{
                        scope.row.billNo
                      }}</template>
                    </el-table-column>
                    <el-table-column label="源单号" width="170">
                      <template slot-scope="scope">{{
                        scope.row.sourceNo
                      }}</template>
                    </el-table-column>
                    <el-table-column label="未核销金额" width="120">
                      <template slot-scope="scope">{{
                        scope.row.uncheckedAmt
                      }}</template>
                    </el-table-column>
                    <el-table-column label="备注" width="160">
                      <template slot-scope="scope">{{
                        scope.row.remark
                      }}</template>
                    </el-table-column>
                    <el-table-column label="已添加" width="80">
                      <template slot-scope="scope">{{
                        scope.row.updateBy_dictText
                      }}</template>
                    </el-table-column>
                  </el-table>
                </div>
                <br />
                <hr />
                <br />
                <div>
                  <div>收款单</div>
                  <el-table
                    ref="multipleTable"
                    tooltip-effect="dark"
                    style="width: 100%"
                  >
                    <el-table-column type="selection" width="55">
                    </el-table-column>
                    <el-table-column label="单据号" width="160">
                      <template slot-scope="scope">{{
                        scope.row.billNo
                      }}</template>
                    </el-table-column>
                    <el-table-column label="源单号" width="160">
                      <template slot-scope="scope">{{
                        scope.row.sourceNo
                      }}</template>
                    </el-table-column>
                    <el-table-column label="未核销金额" width="120">
                      <template slot-scope="scope">{{
                        scope.row.uncheckedAmt
                      }}</template>
                    </el-table-column>
                    <el-table-column label="备注" width="160">
                      <template slot-scope="scope">{{
                        scope.row.remark
                      }}</template>
                    </el-table-column>
                    <el-table-column label="已添加" width="80">
                      <template slot-scope="scope">{{
                        scope.row.updateBy_dictText
                      }}</template>
                    </el-table-column>
                  </el-table>
                </div>
              </div>
              <div
                style="width: 1px; margin: 0 2%; background-color: black"
              ></div>
              <!-- 核销模块 -->
              <div style="width: 48%">
                <div style="height: 300px">
                  <div>核销明细</div>
                  <el-table
                    ref="multipleTable"
                    :data="addForm.finReceivableCheckEntryList"
                    tooltip-effect="dark"
                    style="width: 100%"
                  >
                    <el-table-column type="selection" width="55">
                    </el-table-column>
                    <el-table-column label="分录号" width="170">
                      <template slot-scope="scope">{{
                        scope.row.billNo
                      }}</template>
                    </el-table-column>
                    <el-table-column label="单据号" width="170">
                      <template slot-scope="scope">{{
                        scope.row.sourceNo
                      }}</template>
                    </el-table-column>
                    <el-table-column label="未核销金额" width="120">
                      <template slot-scope="scope">{{
                        scope.row.uncheckedAmt
                      }}</template>
                    </el-table-column>
                    <el-table-column label="核销金额" width="160">
                      <template slot-scope="scope">
                        <el-input
                          type="small"
                          v-model="scope.row.amt"
                        ></el-input>
                      </template>
                    </el-table-column>
                    <el-table-column label="备注" width="80">
                      <template slot-scope="scope">{{
                        scope.row.remark
                      }}</template>
                    </el-table-column>
                  </el-table>
                  <div>核销金额合计：0</div>
                </div>
                <br />
                <hr />
                <br />
                <div>
                  <div>核销明细</div>
                  <el-table
                    ref="multipleTable"
                    tooltip-effect="dark"
                    style="width: 100%"
                  >
                    <el-table-column type="selection" width="55">
                    </el-table-column>
                    <el-table-column label="分录号" width="160">
                      <template slot-scope="scope">{{
                        scope.row.billNo
                      }}</template>
                    </el-table-column>
                    <el-table-column label="单据号" width="160">
                      <template slot-scope="scope">{{
                        scope.row.sourceNo
                      }}</template>
                    </el-table-column>
                    <el-table-column label="未核销金额" width="120">
                      <template slot-scope="scope">{{
                        scope.row.uncheckedAmt
                      }}</template>
                    </el-table-column>
                    <el-table-column label="核销金额" width="160">
                      <template slot-scope="scope">
                        <el-input
                          type="small"
                          v-model="scope.row.amt"
                        ></el-input>
                      </template>
                    </el-table-column>
                    <el-table-column label="备注" width="80">
                      <template slot-scope="scope">{{
                        scope.row.remark
                      }}</template>
                    </el-table-column>
                  </el-table>
                </div>
              </div>
            </div>
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button @click="Cancel('addForm')">取 消</el-button>
            <el-button
              v-if="title == '应收核销 - 新增'"
              type="primary"
              @click="submitForm('addForm')"
              >保存</el-button
            >
            <el-button disabled v-if="title == '应收核销 - 新增'"
              >提交</el-button
            >
            <el-button
              v-if="title == '应收核销 - 编辑'"
              type="primary"
              @click="changeForm('addForm')"
              >保存</el-button
            >
            <el-button disabled v-if="title == '应收核销 - 编辑'"
              >提交</el-button
            >
          </div>
        </el-dialog>
      </div>
      <!-- 分页器 -->
      <div class="pagination">
        <el-pagination
          background
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="1"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="10"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        >
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 表格数据
      ListData: [],
      // 选中数据
      multipleSelection: [],
      // 列表载荷数据
      ListForm: {
        _t: 1730091961,
        billNo: "",
        billDate_begin: "",
        billDate_end: "",
        customerId: "",
        billProcStatus: "",
        isApproved: null,
        isClosed: null,
        column: "createTime",
        order: "desc",
        field:
          "id,,,billNo,billDate,customerId_dictText,billProcStatus_dictText,isApproved_dictText,isClosed_dictText,isVoided_dictText,remark,effectiveTime,approverId_dictText,flowId,createTime,createBy_dictText,sysOrgCode_dictText,updateTime,updateBy_dictText,action",
        pageNo: 1,
        pageSize: 10,
      },
      // 模态框开关
      dialogFormVisible: false,
      // 模态框数据
      addForm: {
        amt: -1.1, // 金额
        approverId: null, // 审核人id
        approverId_dictText: null, // 审核人消息
        attachment: null, // 附件
        billDate: "", // 单据日期
        billNo: "", // 单据编号
        billProcStatus: 12, // 处理状态id
        billProcStatus_dictText: "", // 处理状态
        checkedAmt: 0, // 选择金额
        createBy: "", // 创建账号
        createBy_dictText: "", // 创建人
        createTime: "", // 创建时间
        customerId: "", // 客户id
        customerId_dictText: "", // 客户文本
        effectiveTime: "", // 生效时间
        flowId: null, // 流动id
        id: "", // id
        isApproved: null, // 是否通过
        isApproved_dictText: null, //是否通过文本
        isAuto: 0,
        isAuto_dictText: "否",
        isClosed: null, // 是否关闭
        isClosed_dictText: null, // 是否关闭文本
        isRubric: null, //是否红字
        isRubric_dictText: "", //是否红字id
        isVoided: null, // 是否作废
        isVoided_dictText: null, // 是否作废文本
        receivableType: "199", // 可接受类型
        receivableType_dictText: "", // 其他应收  可接受类型文本
        remark: "", // 备注
        sourceId: null, // 来源id
        sourceNo: null, // 来源编号
        sourceType: null, // 来源类型
        sourceType_dictText: null, // 来源类型文本
        sysOrgCode: "", // 外部命令代码
        uncheckedAmt: null, // 金额数量
        updateBy: null, // 更新人
        updateBy_dictText: null, // 更新人文本
        updateTime: null, // 更新时间
        version: null, // 版本
        finReceivableCheckEntryList: [],
        receivableCheckType: "101",
      },
      // 模态框校验码规则
      rules: {
        billNo: [{ required: true, message: "不能为空", trigger: "blur" }],
        billDate: [{ required: true, message: "不能为空", trigger: "blur" }],
        customerId: [{ required: true, message: "不能为空", trigger: "blur" }],
        amt: [{ required: true, message: "不能为空", trigger: "blur" }],
      },
      // 分页器
      total: 0,
      //  更多操作
      moredelete: false,
      // 搜索展开收起
      arrow_down_up: false,
      arrow_down_up2: false,
      // 客户信息
      CustomerInformation: [],
      // 是否
      YesOrNo: [],
      // 模态框标题
      title: "",
      // 应收单数据
      yingshoutableData: [],
      // 应收单载荷
      ysdListForm: {
        _t: new Date().getTime(),
        customerId: "",
        column: "createTime",
        order: "desc",
        field: "id,,billNo,sourceNo,uncheckedAmt,remark,added",
        pageNo: 1,
        pageSize: 5,
      },
      // yingshouhexiaomingxitableData: [],
      yingshouhexiaomingxiListForm: {
        _t: new Date().getTime(),
        id: "",
      },
    };
  },
  mounted() {
    this.GetList();
  },

  methods: {
    // 查询
    findList() {
      this.GetList();
    },
    // 获取数据
    GetList() {
      let t = new Date().getTime();
      this.addForm._t = t;
      this.axios
        .get("/finance/finReceivableCheck/list/101", {
          params: this.ListForm,
        })
        .then((res) => {
          console.log(res);
          this.ListData = res.data.result.records;
          this.total = res.data.result.total;
        });
    },
    // 展开
    zhankai1() {
      this.axios
        .get("/sys/dict/getDictItems/bas_customer,name,id")
        .then((res) => {
          console.log(res);
          this.CustomerInformation = res.data.result;
        });
      this.axios.get("/sys/dict/getDictItems/yn").then((res) => {
        console.log(res);
        this.YesOrNo = res.data.result;
      });
    },
    // 重置
    reset() {
      this.ListForm._t = new Date().getTime();
      this.ListForm.billNo = "";
      this.ListForm.billDate_begin = "";
      this.ListForm.billDate_end = "";
      this.ListForm.customerId = "";
      this.ListForm.billProcStatus = 12;
      this.ListForm.isApproved = null;
      this.ListForm.isClosed = null;
      this.ListForm.column = "createTime";
      this.ListForm.order = "desc";
      this.ListForm.field =
        "id,,,billNo,billDate,customerId_dictText,billProcStatus_dictText,isApproved_dictText,isClosed_dictText,isVoided_dictText,remark,effectiveTime,approverId_dictText,flowId,createTime,createBy_dictText,sysOrgCode_dictText,updateTime,updateBy_dictText,action";
      this.GetList();
    },
    // 新增按钮
    addButton(row) {
      this.addForm.amt = null; // 金额
      this.addForm.approverId = null; // 审核人id
      this.addForm.approverId_dictText = null; // 审核人消息
      this.addForm.attachment = null; // 附件
      this.addForm.billDate = ""; // 单据日期
      this.addForm.billNo = ""; // 单据编号
      this.addForm.billProcStatus = 12; // 处理状态id
      this.addForm.billProcStatus_dictText = ""; // 处理状态
      this.addForm.checkedAmt = 0; // 选择金额
      this.addForm.createBy = ""; // 创建账号
      this.addForm.createBy_dictText = ""; // 创建人
      this.addForm.createTime = ""; // 创建时间
      this.addForm.customerId = ""; // 客户id
      this.addForm.customerId_dictText = ""; // 客户文本
      this.addForm.effectiveTime = ""; // 生效时间
      this.addForm.flowId = null; // 流动id
      this.addForm.id = ""; // id
      this.addForm.isApproved = null; // 是否通过
      this.addForm.isApproved_dictText = null; //是否通过文本
      this.addForm.isAuto = 0;
      this.addForm.isAuto_dictText = "";
      this.addForm.isClosed = null; // 是否关闭
      this.addForm.isClosed_dictText = null; // 是否关闭文本
      this.addForm.isRubric = null; //是否红字
      this.addForm.isRubric_dictText = ""; //是否红字id
      this.addForm.isVoided = null; // 是否作废
      this.addForm.isVoided_dictText = null; // 是否作废文本
      this.addForm.receivableType = "199"; // 可接受类型
      this.addForm.receivableType_dictText = ""; // 其他应收  可接受类型文本
      this.addForm.remark = ""; // 备注
      this.addForm.sourceId = null; // 来源id
      this.addForm.sourceNo = null; // 来源编号
      this.addForm.sourceType = null; // 来源类型
      this.addForm.sourceType_dictText = null; // 来源类型文本
      this.addForm.sysOrgCode = ""; // 外部命令代码
      this.addForm.uncheckedAmt = null; // 金额数量
      this.addForm.updateBy = null; // 更新人
      this.addForm.updateBy_dictText = null; // 更新人文本
      this.addForm.updateTime = null; // 更新时间
      this.addForm.version = null; // 版本
      this.dialogFormVisible = true; // 显示弹窗
      this.title = row; // 标题
      this.getpayable_bill_no(); // 获取单据编号
    },
    // 确定新增
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.axios
            .post("/finance/finReceivableCheck/add", this.addForm)
            .then((res) => {
              console.log(res);
              if (res.data.code == 200) {
                this.GetList();
                this.$message.success("操作成功");
                this.dialogFormVisible = false;
              } else {
                this.$message.error("操作失败");
                return false;
              }
            });
        } else {
          console.log("修改失败");
          return false;
        }
      });
    },
    // 编辑
    handleClick(row) {
      console.log(row.id);
      this.yingshouhexiaomingxiListForm.id = row.id;
      this.axios
        .get(
          "http://8.142.74.15:48082/jeecg-boot/finance/finReceivableCheck/queryFinReceivableCheckEntryByMainId",
          { params: this.yingshouhexiaomingxiListForm }
        )
        .then((res) => {
          console.log(res);
          // this.yingshouhexiaomingxitableData = res.data.result;
          this.addForm.finReceivableCheckEntryList = res.data.result;
        });
      this.addForm = row;
      this.dialogFormVisible = true;
      this.title = "应收核销 - 编辑";
    },
    // 确定修改
    changeForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.axios
            .put("/finance/finReceivableCheck/edit", this.addForm)
            .then((res) => {
              console.log(res);
              if (res.data.code == 200) {
                this.GetList();
                this.$message.success("操作成功");
                this.dialogFormVisible = false;
              }
            });
        } else {
          console.log("修改失败");
          return false;
        }
      });
    },

    // 取消
    Cancel(formName) {
      this.$refs[formName].resetFields();
      this.dialogFormVisible = false;
    },
    // 删除
    deleteList(row) {
      console.log(row);
      this.axios
        .delete("/finance/finReceivableCheck/delete", {
          params: { id: row.id },
        })
        .then((res) => {
          console.log(res);
          if (res.data.code == 200) {
            this.$message.success("操作成功");
            this.GetList();
          } else {
            this.$message.error(`${res.data.message}`);
          }
        });
    },
    // 是否全选数据
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    // 批量删除
    MoreDelete() {
      let ids = {};
      for (let i = 0; i < this.multipleSelection.length; i++) {
        ids[i] = this.multipleSelection[i].id;
      }
      console.log(ids);

      this.$confirm(`是否对id=[${ids}]进行批量删除的操作？`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        this.axios
          .delete(`/finance/finReceivableCheck/deleteBatch?id=${ids}`)
          .then((res) => {
            console.log(res);
            this.$message.success("操作成功");
            this.GetList();
          });
      });
    },
    // 分页器
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.ListForm.limit = val;
      this.GetList();
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.ListForm.page = val;
      this.GetList();
    },
    // 清空
    qingkong() {
      this.$refs.multipleTable.clearSelection();
    },
    // 获取单据编号
    getpayable_bill_no() {
      this.axios
        .put("/sys/fillRule/executeRuleByCode/payable_bill_no", {})
        .then((res) => {
          console.log(res);
          this.addForm.billNo = res.data.result;
        });
    },
    // 获取应收单信息
    Getyingshoudan() {
      this.axios
        .get("/finance/finReceivable/checkableList", {
          params: this.ysdListForm,
        })
        .then((res) => {
          console.log(res);
          this.yingshoutableData = res.data.result.records;
        });
    },
  },
  watch: {
    // 监听选中数据
    multipleSelection(newVal) {
      if (newVal.length == 0) {
        this.moredelete = false;
      }
      if (newVal.length !== 0) {
        this.moredelete = true;
      }
      console.log(newVal);
    },
    // 监听是否展开
    arrow_down_up(newVal) {
      if (newVal == true) {
        this.zhankai1();
      }
    },
    // 监听模态框
    dialogFormVisible(newVal) {
      if (newVal == true) {
        this.zhankai1();
      }
    },
    // 监听客户信息
    "addForm.customerId"(newVal) {
      console.log(newVal);
      this.ysdListForm.customerId = newVal;
      this.Getyingshoudan();
    },
  },
};
</script>
<style lang="scss" scoped>
.taks {
  padding: 15px;
  background-color: #f1f4f5;
  .content {
    width: 100%;
    height: 100%;
    padding: 15px;
    background-color: #fff;
    .top {
      display: flex;
    }
    .table {
      margin-top: 10px;
    }
    .pagination {
      margin-top: 10px;
      display: flex;
      justify-content: flex-end;
      align-items: center;
    }
  }
  ::v-deep .cell {
    text-align: center;
    font-size: 14px;
  }
  .el-dropdown-link {
    cursor: pointer;
    color: #409eff;
  }
  .el-icon-arrow-down {
    font-size: 12px;
  }
  ::v-deep .el-form-item:nth-child(5) {
    display: inline;
  }
  .leftButton .el-button {
    margin: 10px 10px 0 10px;
  }
}
</style>